/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tesis.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author hectdx
 */
@Entity
@Table(name = "estacion_x_varible")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EstacionXVarible.findAll", query = "SELECT e FROM EstacionXVarible e"),
    @NamedQuery(name = "EstacionXVarible.findByIdestacionvariable", query = "SELECT e FROM EstacionXVarible e WHERE e.idestacionvariable = :idestacionvariable"),
    @NamedQuery(name = "EstacionXVarible.findByFechaasignacion", query = "SELECT e FROM EstacionXVarible e WHERE e.fechaasignacion = :fechaasignacion")})
public class EstacionXVarible implements Serializable {
    @Column(name = "fechaasignacion")
    @Temporal(TemporalType.DATE)
    private Date fechaasignacion;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idestacionvariable")
    private Integer idestacionvariable;
    @JoinColumn(name = "idvariable", referencedColumnName = "idvariable")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Variable idvariable;
    @JoinColumn(name = "idestacion", referencedColumnName = "idestacion")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Estacion idestacion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idestacionvariable", fetch = FetchType.LAZY)
    private List<ParametroVariable> parametroVariableList;

    public EstacionXVarible() {
    }

    public EstacionXVarible(Integer idestacionvariable) {
        this.idestacionvariable = idestacionvariable;
    }

    public Integer getIdestacionvariable() {
        return idestacionvariable;
    }

    public void setIdestacionvariable(Integer idestacionvariable) {
        this.idestacionvariable = idestacionvariable;
    }

    public Variable getIdvariable() {
        return idvariable;
    }

    public void setIdvariable(Variable idvariable) {
        this.idvariable = idvariable;
    }

    public Estacion getIdestacion() {
        return idestacion;
    }

    public void setIdestacion(Estacion idestacion) {
        this.idestacion = idestacion;
    }

    @XmlTransient
    public List<ParametroVariable> getParametroVariableList() {
        return parametroVariableList;
    }

    public void setParametroVariableList(List<ParametroVariable> parametroVariableList) {
        this.parametroVariableList = parametroVariableList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idestacionvariable != null ? idestacionvariable.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EstacionXVarible)) {
            return false;
        }
        EstacionXVarible other = (EstacionXVarible) object;
        if ((this.idestacionvariable == null && other.idestacionvariable != null) || (this.idestacionvariable != null && !this.idestacionvariable.equals(other.idestacionvariable))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tesis.domain.EstacionXVarible[ idestacionvariable=" + idestacionvariable + " ]";
    }

    public Date getFechaasignacion() {
        return fechaasignacion;
    }

    public void setFechaasignacion(Date fechaasignacion) {
        this.fechaasignacion = fechaasignacion;
    }
    
}
